<!--窗口头部-->
				<div class="modal-header">
					<span class="close" data-dismiss="modal">&times;</span>
					<h5 class="modal-title">用户登陆</h5>
				</div>
				<!--窗口主要显示区域-->
				<div class="modal-body">
					<form id="f-login" class="form-horizontal">
						<div class="form-group">
							<label class="control-label col-sm-2" for="username">用户名:</label>
							<div class="col-sm-10">
								<input class="form-control" type="text" name="username" id="username" value="" placeholder="请输入用户名或注册邮箱地址" />
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-sm-2" for="password">密码:</label>
							<div class="col-sm-10">
								<input class="form-control" type="password" name="password" id="password" value="" placeholder="请输入密码" />
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-sm-2" for="code">验证码:</label>
							<div class="col-sm-10">
								<div class="input-group">
									<input class="form-control" type="text" name="code" id="code" value="" />
									<div class="input-group-btn">
										<button id="btn-gdcode" type="button" class="btn btn-default" style="padding: 1px;"><img id="gdcode" src="gdcode.php"/></button>
									</div>
								</div>
								
							</div>
							<!--<div class="col-sm-3"><img src="img/gdcode.png" style="width: 100px; height: 30px;" alt="" /></div>-->
						</div>
					</form>
				</div>
				<!--弹出窗口底部-->
				<div class="modal-footer">
					<button onclick="location.href='password.php'" class="btn btn-info">重设密码</button>
					<button class="btn btn-warning" onclick="$('#f-login')[0].reset()">重置</button>
					<button id="bt-login" class="btn btn-info">登陆</button>
				</div>
				
				<!--<script src="js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>-->
				<script type="text/javascript">
					$('#btn-gdcode').on('click',function(){
						$('#gdcode').attr('src','gdcode.php?'+ Math.random());
						//return false;
					});
					$('#bt-login').on('click',function(e){
						//alert('你按了登陆!');
						var formData = new FormData();
						formData.append('username',$("#f-login")[0].username.value);
						formData.append('password',$.md5($("#f-login")[0].password.value));
						formData.append('code',$("#f-login")[0].code.value);
						//console.log(formData);
						//formData['password'] = $.md5(formData['password']);
						e.target.innerHTML = '<img src="img/ajax-loader.gif" />登陆中';
						$(e.target).attr('disabled','disabled');
						
						$.ajax({
				            type: 'post',
				            url: 'ajax_login.php',
				            data: formData,//$('#form1').serialize(),
				            dataType: 'json',
				            contentType: false, //上传文件必须
							processData: false, //上传文件必须
				            success: function (result) {
				            	//console.log(result);
				                if (result.success == "1") {
				                	alert("登陆成功,确认后返回首页!");
				                    console.log(result.data);
				                   	location.href = 'index.php';
				                } else {
				                	alert('登陆失败:'+result.msg);
				                    console.log('登陆失败:'+result.msg);
				                }
				                e.target.innerHTML = '登陆';
								$(e.target).removeAttr('disabled');
				            },
				            error: function (err) {
				                alert("提交出错");
				                e.target.innerHTML = '登陆';
								$(e.target).removeAttr('disabled');
				                console.log(err);
				            }
				        })
						
						
					});
					
				</script>
